package com.mtao.utils;

import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesisListResult;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesisParam;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.Constants;
import org.springframework.stereotype.Component;


@Component
public class DashscopeUtil {
    public static void basicCall() throws ApiException, NoApiKeyException, NoApiKeyException {
        String taskId = "89180";
        ImageSynthesis is = new ImageSynthesis();
//        # linux
//        export DASHSCOPE_API_KEY="YOUR_DASHSCOPE_API_KEY"
//
        //#windows
//        setx DASHSCOPE_API_KEY "YOUR_DASHSCOPE_API_KEY"
        Constants.apiKey="sk-335743b8203a4ab1af44884939fd76fb";
        ImageSynthesisParam param =
                ImageSynthesisParam.builder()
                        .model(ImageSynthesis.Models.WANX_V1)
                        .n(4)
                        .size("1024*1024")
                        .prompt("雄鹰自由自在的在蓝天白云下飞翔")
                        .build();
        ImageSynthesisResult result = is.call(param);
        System.out.println(result);
    }
}
